﻿<%@ Page Language="c#" ContentType="text/html" ResponseEncoding="utf-8" Async="true" MasterPageFile="~/administration/list_private.master" Inherits="ACM.cmsarea08.Administration.Core.GesMedia" %>
<%@ MasterType VirtualPath="~/administration/list_private.master" %>
<asp:Content ID="PageBody" Runat="server" ContentPlaceHolderID="MasterBody">
<h1><img src="../template/admimg/media.jpg" alt="Media Manager" />Gestione Media</h1>
<div id="filter" >
	<asp:DropDownList ID="dropmedia" runat="server"></asp:DropDownList>
	<asp:Button id="ref_btn" runat="server" Text=""></asp:Button>
</div>

<div id="filter" style="float:right;">
	<asp:TextBox ID="nomecartella" runat="server"></asp:TextBox>
	<asp:Button id="create_folder" runat="server" Text=""></asp:Button>
	
	
</div>
<style type="text/css">
ul.files li {
	width:60px;
	height:70px;
	padding:5px;
	padding-bottom:20px;
	margin:2px;
	margin-bottom:6px;
	float:left;
	
	list-style:none;
	border:2px outset #000000;
	text-align:center;
	color:#000000;
	text-decoration:none;
	font-size:11px;
	font-family:trebuchet;
}
ul.files li:hover{
	border:#000000 inset 2px;
	background-color:#CCCCCC;
	
	padding:5px;
	padding-bottom:20px;
	
}

ul.files li a,a:visited{
	color:#000000;
	text-decoration:none;
	display:block;

}

ul.files li a:hover {
	margin:auto;
	text-decoration:none;
	display:block;
}
ul.files li img{
	text-align:center;
	max-width:40px;
	max-height:55px;
	width:40px;
/*	height:55px;*/
	margin:auto;
	border: 1px solid #000000;
	clear:both;
	display:block;
	
}
ul.files input{
	margin:auto;
	margin-bottom:5px;
	width:55px;
	
}

li.parent{
background-color:#B7CBFF;
}
.files li.parent:hover{
background-color:#95a9dd; 
}

</style>
<br />
elenco dei File disponibili
<div id="filelist" runat="server">
</div><br/>
<div id="editalert" style="margin:auto;display:none;">
	<span class="text_info">Attenzione: alcuni elementi sono stati rinominati. Per confermare tali modifiche premere sul pulsante apposito</span>

</div>
<input id="remember" value="" runat="server" type="hidden" />
<input id="renaming" value="" runat="server" type="hidden" />

<script language="javascript" type="text/javascript">
var remember = document.getElementById('<%=remember.ClientID %>');
var renaming = document.getElementById('<%=renaming.ClientID %>');
var isedited = false;


function RemeberMyValue(chkID){

	var checkbox = document.getElementById(chkID);

	
	if(checkbox.checked==true){

		remember.value += '|' + checkbox.getAttribute('rel');

	}
	else{
		remember.value = '|' + remember.value.replace(checkbox.getAttribute('rel'),'');
	}


}

function rinomina(span){
	var rel = span.getAttribute("rel");
	var spans = document.getElementsByTagName('span');
	var inputs = document.getElementsByTagName('input');
	for(var i=0; i<spans.length;i++){
		if(spans[i] != span)
			spans[i].style.display="";
		else{
			if(span.style.display=="")
				span.style.display="none";
			else
				span.style.display="";
		}
	}
	for(var i=0; i<inputs.length;i++){
		if(inputs[i].type != "text" || inputs[i].getAttribute("rel") == null)
			continue;
			var inputrel = inputs[i].getAttribute("rel");
			if(inputrel.indexOf(':')==0)
				inputrel = inputrel.substring(1);
		if(inputrel == rel){
			inputs[i].style.display="";
			inputs[i].focus();
		}
		else{
			inputs[i].style.display="none";
			
		} 
	}
}

function resettafocus() {
		
	var spans = document.getElementsByTagName('span');
	var inputs = document.getElementsByTagName('input');
	var newvalue = "";
	for(var i=0; i<inputs.length;i++){
		if(inputs[i].type != "text" || inputs[i].getAttribute("rel") == null)
			continue;
			if(inputs[i].style.display=="" && inputs[i].value.trim()!=""){
							
				newvalue = inputs[i].value + prendiestensione(inputs[i]);
				
				if(isedited){
					
					renaming.value += inputs[i].getAttribute("rel") + '>' + newvalue  + '|';
					
					isedited=false;
				}
				if(newvalue.length >11)
					newvalue = newvalue.substring(0,10) + '...';
			}
		inputs[i].style.display="none";
	}
	for(var i=0; i<spans.length;i++){
		if(spans[i].style.display=="none" && newvalue!="")
			
			spans[i].innerHTML = newvalue;
			spans[i].style.display="";
		
	}
	
}	

function mostra_alert(){
	document.getElementById('editalert').style.display="";
	return;


}

function salvatemp(event){
	mostra_alert();
	isedited = true;
	switch (event.keyCode){
	
		case 27: case 88: case 67: this.resettafocus(event.keyCode); break;
	//	case 37: case 80: this.previous(); break;	
	//	case 39: case 78: this.next();
	}	
}

function prendiestensione(item){
	var rel = item.getAttribute('rel');
	if(rel.indexOf(':')==0)
		return '';
	
	rel = rel.substring(rel.lastIndexOf('.'))
	
	return rel;

}

function tagliaparola(testo){}

</script>

</asp:content>
